/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package engine.damage;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import mainpackage.Constant;
import mainpackage.MainLogic;
import mainpackage.ResManager;
import mainpackage.Tools;

/**
 *
 * @author Administrator
 */
public class Damage {

    private boolean[] bHas;  //是否存储了伤害的信息
    private int[] iStartX, iStartY;//伤害数字起始位置
    private byte[] byDamageType = null; //伤害的类型
    private byte[] byDamageBigType = null; //伤害的类型
    private boolean[] blCanShowDamage = null; //伤害的类型
    private String[] sDamageValue;//伤害值
    private short[] shOffsetX, shOffsetY; //数字最最终的偏移量
    private byte[] byFlyCounter;
    /*************************************************************/
    public boolean[] bShowBooldAni = null;
    //#if NOKIA_S40V3 || NORMAL_240_400 || MOTO || K790
//#     private String[] strWordPic = null;
    //#else
    private Image numericPic = null; //伤害或是增益数字
    private Image wordPic = null;// 文字图片
    private Image critNumPic = null; //暴击数字图片
    //#endif
    //要显示的伤害的个数
    private byte size = 0;
    /**伤害动画**************************/
    private int[] dizzinessAni = null; // 眩晕动画
    private int[] gainAni = null; // 增益效果动画
    private int[] iAniStatus;
    //伤害的大类型 1 玩家攻击
    public static final byte DAMAGE_BIGTYPE_PLAYERATTACK = 1; //幸运一击
    //添加的伤害类型 
    public static final byte DAMAGE_TYPE_CRIT = 1; //幸运一击
    public static final byte DAMAGE_TYPE_DODGE = 2; // 闪避
    public static final byte DAMAGE_TYPE_PLAYER = 3; //玩家受到的攻击的伤害
    public static final byte DAMAGE_TYPE_MONSTER = 4; //怪物受到的攻击伤害
    public static final byte DAMAGE_TYPE_ICE = 5;// 冰伤害
    public static final byte DAMAGE_TYPE_FIRE = 6; //火伤害
    public static final byte DAMAGE_TYPE_POISON = 7; //毒伤害
    public static final byte DAMAGE_TYPE_RESISY = 8;//抵抗了伤害
    //增益
    public static final byte GAIN_TYPE_BLOOD = 9; //玩家增益魔法增加的血
    public static final byte GAIN_TYPE_MAGIC = 10; //玩家增益魔法增加的魔法量
    public static final byte GAIN_TYPE_OTHER = 11; //玩家增益魔法增加的其他
    //战斗
    public static final byte PLAYER_OUT_BATTLE = 12; //玩家脱离战斗
    public static final byte PLAYER_INTO_BATTLE = 13; //进入战斗
    //其他
    public static final byte BUFF_DIZZINESS = 14; // 眩晕buff
    public static final byte PLAYER_UPGRADE = 15; //玩家升级
    public static final byte FLY_FRAMES = 5; //绘制的帧数

    public Damage() {
    }

    public void initDamage() {
        this.bHas = new boolean[Constant.MAX_DAMAGE_ARRAY_SIZE];
        this.iStartX = new int[Constant.MAX_DAMAGE_ARRAY_SIZE];
        this.iStartY = new int[Constant.MAX_DAMAGE_ARRAY_SIZE];
        this.byDamageType = new byte[Constant.MAX_DAMAGE_ARRAY_SIZE];
        this.byDamageBigType = new byte[Constant.MAX_DAMAGE_ARRAY_SIZE];
        this.shOffsetX = new short[Constant.MAX_DAMAGE_ARRAY_SIZE];
        this.shOffsetY = new short[Constant.MAX_DAMAGE_ARRAY_SIZE];
        this.sDamageValue = new String[Constant.MAX_DAMAGE_ARRAY_SIZE];
        this.byFlyCounter = new byte[Constant.MAX_DAMAGE_ARRAY_SIZE];
        this.bShowBooldAni = new boolean[Constant.MAX_DAMAGE_ARRAY_SIZE];
        this.blCanShowDamage = new boolean[Constant.MAX_DAMAGE_ARRAY_SIZE];
        try {
            iAniStatus = new int[5];
            dizzinessAni = new int[5];
            gainAni = new int[5];
            for (int i = 0; i < 5; i++) {
                this.iAniStatus[i] = 0;
            }
            //#if NOKIA_S40V3 || NORMAL_240_400 || MOTO || K790
//#             if (strWordPic == null) {
//#                 strWordPic = new String[]{"进入战斗", "退出战斗", "抵御", "幸运一击", "闪避", "恭喜你升级了"};
//#             }
            //#else
            if (this.numericPic == null) {
                this.numericPic = ResManager.createImage(90000023);
            }
            if (this.wordPic == null) {
                this.wordPic = ResManager.createImage(90000024);
            }
            if (this.critNumPic == null) {
                this.critNumPic = ResManager.createImage(90000022);
            }
            //#endif
//            if (this.bloodAni == null) 
            ResManager.loadAnimation(Constant.RES_BLOOD_ANI_PATH, Constant.RES_PUBLIC_FINAL, false);
//                ResManager.loadAnimation(Constant.RES_DIZZINESS_ANI_PATH,Constant.RES_PUBLIC_FINAL);
//                 ResManager.loadAnimation(Constant.RES_GAIN_ANI_PATH,Constant.RES_PUBLIC_FINAL);
//            if (this.dizzinessAni == null) 
//                this.dizzinessAni = ResManager.loadAnimation(Constant.RES_DIZZINESS_ANI_PATH,Constant.RES_PUBLIC_FINAL);
//            if (this.gainAni == null) 
//                this.gainAni =  ResManager.loadAnimation(Constant.RES_GAIN_ANI_PATH,Constant.RES_PUBLIC_FINAL);
            this.size = 0;
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void drawDamage(Graphics g) {
        boolean blShowBlood = false;
        for (int i = 0; i < Constant.MAX_DAMAGE_ARRAY_SIZE; i++) {
            if (!this.bHas[i]) {
                continue;
            }
            if (this.bShowBooldAni[i]) {
                blShowBlood = true;
            }
            if (this.byDamageBigType[i] == DAMAGE_BIGTYPE_PLAYERATTACK && !this.blCanShowDamage[i]) {
                return;
            }
            switch (this.byDamageType[i]) {
                case DAMAGE_TYPE_CRIT: //幸运一击
                case DAMAGE_TYPE_DODGE: // 闪避
                case PLAYER_OUT_BATTLE: //玩家脱离战斗
                case PLAYER_INTO_BATTLE: //进入战斗
                case DAMAGE_TYPE_RESISY://抵抗伤害
                    this.drawDamageWord(g, this.byDamageType[i], this.sDamageValue[i], this.iStartX[i] + this.shOffsetX[i], this.iStartY[i] + this.shOffsetY[i]);
                    break;
                case PLAYER_UPGRADE: //玩家升级
                    ResManager.drawAnimation(ResManager.getAnimation(Constant.RES_GAIN_ANI_PATH, Constant.RES_PUBLIC_FINAL), this.gainAni, g, this.iStartX[i], this.iStartY[i], true);
                    this.drawDamageWord(g, this.byDamageType[i], this.sDamageValue[i], this.iStartX[i] + this.shOffsetX[i], this.iStartY[i] + this.shOffsetY[i]);
                    break;
                case DAMAGE_TYPE_PLAYER: //玩家受到的攻击的伤害
                case DAMAGE_TYPE_MONSTER: //怪物受到的攻击伤害
                case DAMAGE_TYPE_ICE:// 冰伤害
                case DAMAGE_TYPE_FIRE: //火伤害
                case DAMAGE_TYPE_POISON: //毒伤害
                    this.drawDamageNum(g, this.byDamageType[i], this.sDamageValue[i], this.iStartX[i] + this.shOffsetX[i], this.iStartY[i] + this.shOffsetY[i]);
                    break;
                case GAIN_TYPE_BLOOD: //玩家增益魔法增加的血
                case GAIN_TYPE_MAGIC: //玩家增益魔法增加的魔法量
                case GAIN_TYPE_OTHER: //玩家增益魔法增加的其他
                    ResManager.drawAnimation(ResManager.getAnimation(Constant.RES_GAIN_ANI_PATH, Constant.RES_PUBLIC_FINAL), this.gainAni, g, this.iStartX[i], this.iStartY[i], true);
                    this.drawDamageNum(g, this.byDamageType[i], this.sDamageValue[i], this.iStartX[i] + this.shOffsetX[i], this.iStartY[i] + this.shOffsetY[i]);
                    break;
                //其他
                case BUFF_DIZZINESS: // 眩晕buff
                    ResManager.drawAnimation(ResManager.getAnimation(Constant.RES_DIZZINESS_ANI_PATH, Constant.RES_PUBLIC_FINAL), this.dizzinessAni, g, this.iStartX[i], this.iStartY[i], true);
                    break;
            }
        }
        if (blShowBlood) {
            Tools.printLog("绘制喷血动画");
            if (MainLogic.iLockedObjNumber[0][0] != -1) {
                ResManager.drawAnimation(ResManager.getAnimation(Constant.RES_BLOOD_ANI_PATH, Constant.RES_PUBLIC_FINAL), this.iAniStatus, g, (int) (MainLogic.iLockedObjNumber[0][2] - MainLogic.gameMap.iMapWorldOffsetX), (int) ((MainLogic.iLockedObjNumber[0][3] - MainLogic.gameMap.iMapWorldOffsetY) - ((MainLogic.iLockedObjNumber[0][4] == Constant.LOCKED_TYPE_NPC) ? MainLogic.getInstance().gameNpcArray.shNpcHeight[(int) (MainLogic.iLockedObjNumber[0][1])] : 60)), false);
            }
        }
    }

    public void updateDamage() {
        for (byte i = 0; i < Constant.MAX_DAMAGE_ARRAY_SIZE; i++) {
            if (!this.bHas[i]) {
                continue;
            }
            if (this.byFlyCounter[i] >= FLY_FRAMES) {
                this.delDamage(i);
                continue;
            } else {
                if (this.byDamageBigType[i] == DAMAGE_BIGTYPE_PLAYERATTACK && !this.blCanShowDamage[i]) {
                    if (MainLogic.getInstance().gamePlayer.ifPlayerAttackOver()) {
                        this.blCanShowDamage[i] = true;
                    } else {
                        return;
                    }
                }
                this.shOffsetY[i] = (short) (this.shOffsetY[i] - 10);
                this.byFlyCounter[i]++;
            }
        }
    }

    /**
     * @param byTargetType 受到攻击的类型:1玩家，2：怪物
     * @param byBigType 类型
     * @param iIceDamage 冰伤害
     * @param iFireDamage 火伤害
     * @param iPoisionDamage 毒伤害
     * @param iFisDamage 物理伤害
     * @param byHit  命中
     * @param blshowDouble 幸运一击
     * @param byDirection 方向
     * @param startX 位置
     * @param startY 位置
     * @param shOffset  偏移
     */
    public void addBattleDamage(byte byTargetType, byte byBigType, int iIceDamage, int iFireDamage, int iPoisionDamage, int iFisDamage, byte byHit, byte blshowDouble, byte byDirection, int startX, int startY, byte bySkillType, short shOffset) {
        if (!MainLogic.getInstance().uiEquipment.isopenset[19]) {
            return;
        }
        if (shOffset == 0) {
            shOffset = -45;
        }
        //冰伤害
        if (iIceDamage != 0) {
            MainLogic.damage.addDamage(byBigType, MainLogic.damage.DAMAGE_TYPE_ICE, iIceDamage, false, byDirection, startX, startY, shOffset);
        }
        //火伤害
        if (iFireDamage != 0) {
            MainLogic.damage.addDamage(byBigType, MainLogic.damage.DAMAGE_TYPE_FIRE, iFireDamage, false, byDirection, startX, startY, shOffset);
        }
        //毒伤害
        if (iPoisionDamage != 0) {
            MainLogic.damage.addDamage(byBigType, MainLogic.damage.DAMAGE_TYPE_POISON, iPoisionDamage, false, byDirection, startX, startY, shOffset);
        }
        //物理伤害
        if (iFisDamage != 0) {
            if (blshowDouble == 1) {//幸运一击
                MainLogic.damage.addDamage(byBigType, MainLogic.damage.DAMAGE_TYPE_CRIT, iFisDamage, false, byDirection, startX, startY, shOffset);
            } else {//普通
                if (byTargetType == 1) {
                    MainLogic.damage.addDamage(byBigType, MainLogic.damage.DAMAGE_TYPE_PLAYER, iFisDamage, false, byDirection, startX, startY, shOffset);
                } else {
                    MainLogic.damage.addDamage(byBigType, MainLogic.damage.DAMAGE_TYPE_MONSTER, iFisDamage, false, byDirection, startX, startY, shOffset);
                }
            }
        } else if (bySkillType == 0 && iFisDamage == 0 && byHit != 0) { //抵御
            MainLogic.damage.addDamage(byBigType, MainLogic.damage.DAMAGE_TYPE_RESISY, iFisDamage, false, byDirection, startX, startY, shOffset);
        }
    }

    /**
     * 添加伤害或是其他的动画
     */
    /**
     *
     * @param byDamageType 伤害的类型
     * @param damageNumm  伤害的数字
     * @param startX  //显示伤害的
     * @param startY
     */
    public void addDamage(byte bigtype, byte byDamageType, int damageNum, boolean bShowBloodAni, byte dirctrion, int startX, int startY, int iOffsetY) {
        if (!MainLogic.getInstance().uiEquipment.isopenset[19]
                && byDamageType != PLAYER_INTO_BATTLE
                && byDamageType != PLAYER_OUT_BATTLE) {
            return;
        }
        if (damageNum == 0) {
            switch (byDamageType) {
                case DAMAGE_TYPE_CRIT:
                case DAMAGE_TYPE_DODGE:
                case DAMAGE_TYPE_RESISY:
                case PLAYER_OUT_BATTLE:
                case PLAYER_INTO_BATTLE:
                case PLAYER_UPGRADE:
                case BUFF_DIZZINESS:
                    break;
                default:
                    return;
            }
        }
        if (iOffsetY == 0) {
            iOffsetY = -45;
        }
        byte byDamageIndex = -1;
        byte byMaxFlyCounterIndex = -1;
        byte iFlyCounter = 0;
        for (byte i = 0; i < Constant.MAX_DAMAGE_ARRAY_SIZE; i++) {
            if (this.bHas[i]) {
                if (iFlyCounter < this.byFlyCounter[i]) {
                    iFlyCounter = this.byFlyCounter[i];
                    byMaxFlyCounterIndex = i;
                }
            } else {
                byDamageIndex = i;
                break;
            }
        }
        if (byDamageIndex == -1 && byMaxFlyCounterIndex > - 1) {
            byDamageIndex = byMaxFlyCounterIndex;
        }
        if (byDamageIndex == -1) {
            byDamageIndex = 0;
        }
        this.byDamageType[byDamageIndex] = byDamageType;
        this.byDamageBigType[byDamageIndex] = bigtype;
        this.bHas[byDamageIndex] = true;
        this.iStartY[byDamageIndex] = startY - iOffsetY;
        this.byFlyCounter[byDamageIndex] = 0;
        this.bShowBooldAni[byDamageIndex] = bShowBloodAni;
        if (byDamageType == DAMAGE_TYPE_CRIT) {
            this.sDamageValue[byDamageIndex] = String.valueOf(Math.abs(damageNum));
        } else {
            if (damageNum > 0) {
                this.sDamageValue[byDamageIndex] = "+" + String.valueOf(Math.abs(damageNum));
            } else {
                this.sDamageValue[byDamageIndex] = "-" + String.valueOf(Math.abs(damageNum));
            }
        }
        this.shOffsetX[byDamageIndex] = 0;
        this.shOffsetY[byDamageIndex] = 0;
        this.iStartX[byDamageIndex] = startX;
//        Tools.printLog("原始坐标:" + this.iStartX[byDamageIndex]);
        switch (byDamageType) {
            case DAMAGE_TYPE_CRIT: //幸运一击
                this.iStartX[byDamageIndex] -= ((70 + this.sDamageValue[byDamageIndex].length() * 15) >> 1);
                break;
            case DAMAGE_TYPE_DODGE: // 闪避
                this.iStartX[byDamageIndex] -= 16;
                break;
            case DAMAGE_TYPE_RESISY://抵御
                this.iStartX[byDamageIndex] -= 16;
                break;
            case PLAYER_OUT_BATTLE: //玩家脱离战斗
                this.iStartX[byDamageIndex] -= 29;
                this.shOffsetY[byDamageIndex] -= 30;
                break;
            case PLAYER_INTO_BATTLE: //进入战斗
                this.iStartX[byDamageIndex] -= 29;
                this.shOffsetY[byDamageIndex] -= 30;
                break;
            case PLAYER_UPGRADE: //玩家升级
                this.shOffsetY[byDamageIndex] -= 30;
                this.iStartX[byDamageIndex] -= 40;
                break;
            case DAMAGE_TYPE_PLAYER: //玩家受到的攻击的伤害
            case DAMAGE_TYPE_MONSTER: //怪物受到的攻击伤害
                this.iStartX[byDamageIndex] -= ((this.sDamageValue[byDamageIndex].length() * 10) >> 1);
                break;
            case DAMAGE_TYPE_ICE:// 冰伤害
                this.iStartX[byDamageIndex] -= 20;
                this.iStartX[byDamageIndex] -= ((this.sDamageValue[byDamageIndex].length() * 10) >> 1);
                break;
            case DAMAGE_TYPE_FIRE: //火伤害
                this.iStartX[byDamageIndex] += 20;
                this.iStartX[byDamageIndex] -= ((this.sDamageValue[byDamageIndex].length() * 10) >> 1);
                break;
            case DAMAGE_TYPE_POISON: //毒伤害
                this.iStartY[byDamageIndex] -= 20;
                this.iStartX[byDamageIndex] -= ((this.sDamageValue[byDamageIndex].length() * 10) >> 1);
                break;
            case GAIN_TYPE_BLOOD: //玩家增益魔法增加的血
            case GAIN_TYPE_MAGIC: //玩家增益魔法增加的魔法量
            case GAIN_TYPE_OTHER: //玩家增益魔法增加的其他
                this.iStartX[byDamageIndex] -= ((this.sDamageValue[byDamageIndex].length() * 10) >> 1);
                break;
            //其他
            case BUFF_DIZZINESS: // 眩晕buff
                break;
            default:
                break;
        }
        if (bShowBloodAni) {
            ResManager.changeAction(ResManager.getAnimation(Constant.RES_BLOOD_ANI_PATH, Constant.RES_PUBLIC_FINAL), (Tools.random(0, 1) == 0) ? dirctrion + 4 : dirctrion, 0, iAniStatus);

        }
//        Tools.printLog("改变后的坐标:" + this.iStartX[byDamageIndex]);
        this.size += 1;
    }

    public void delDamage(byte index) {
        this.bHas[index] = false;
        this.byFlyCounter[index] = 0;
        this.iStartX[index] = 0;
        this.iStartY[index] = 0;
        this.byDamageType[index] = -1;
        this.byDamageBigType[index] = -1;
        this.blCanShowDamage[index] = false;
        this.sDamageValue[index] = null;
        this.bShowBooldAni[index] = false;
        this.size -= 1;
    }

    /**
     * 绘制伤害数字
     * @param g
     * @param byRow   //数字开始的行数
     * @param numeric //数字字符串
     * @param startX
     * @param startY
     * @return
     */
    private int drawDamageNum(Graphics g, byte byDamageType, String numeric, int startX, int startY) {
        int iPicNumStartX = 0;
        String sNum;
        int iNumStartX = 0;
        int iNumStartY = 0;
        //#if NOKIA_S40V3 || NORMAL_240_400 || MOTO || K790
//#         int fontColor = 0xffffff;
//#         switch (byDamageType) {
//#             case DAMAGE_TYPE_PLAYER: //玩家受到的攻击的伤害
//#                 fontColor = 0xff0000;
//#                 break;
//#             case DAMAGE_TYPE_MONSTER: //怪物受到的攻击伤害
//#                 fontColor = 0xff6600;
//#                 break;
//#             case DAMAGE_TYPE_ICE:// 冰伤害
//#                 fontColor = 0x00ccff;
//#                 break;
//#             case DAMAGE_TYPE_FIRE: //火伤害
//#                 fontColor = 0xffff00;
//#                 break;
//#             case DAMAGE_TYPE_POISON: //毒伤害
//#                 fontColor = 0x00ff33;
//#                 break;
//#             case GAIN_TYPE_BLOOD: //玩家增益魔法增加的血
//#                 fontColor = 0x00ff33;
//#                 break;
//#             case GAIN_TYPE_MAGIC: //玩家增益魔法增加的魔法量
//#                 fontColor = 0x00ccff;
//#                 break;
//#             case GAIN_TYPE_OTHER: //玩家增益魔法增加的其他
//#                 fontColor = 0xffffff;
//#                 break;
//#         }
//#         Tools.drawShadowString(g, (byte) 1, numeric, startX, startY + 7, fontColor, 0xffffff);
        //#else
        switch (byDamageType) {
            case Damage.DAMAGE_TYPE_PLAYER: //玩家受到的攻击的伤害
                //iNumStartY = 5 * 17;
                iNumStartY = 68;
                break;
            case Damage.DAMAGE_TYPE_MONSTER: //怪物受到的攻击伤害
                //iNumStartY = 4 * 17;
                iNumStartY = 51;
                break;
            case Damage.DAMAGE_TYPE_ICE:// 冰伤害
                // iNumStartY = 17;
                iNumStartY = 0;
                break;
            case Damage.DAMAGE_TYPE_FIRE: //火伤害
                //iNumStartY = 3 * 17;
                iNumStartY = 34;
                break;
            case Damage.DAMAGE_TYPE_POISON: //毒伤害
                //iNumStartY = 2 * 17;
                iNumStartY = 17;
                break;
            case Damage.GAIN_TYPE_BLOOD: //玩家增益魔法增加的血
                //iNumStartY = 2 * 17;
                iNumStartY = 17;
                break;
            case Damage.GAIN_TYPE_MAGIC: //玩家增益魔法增加的魔法量
                //iNumStartY = 17;
                iNumStartY = 0;
                break;
            case Damage.GAIN_TYPE_OTHER: //玩家增益魔法增加的其他
                //iNumStartY = 0;
                iNumStartY = 0;
                break;
        }
        for (byte i = 0; i < numeric.length(); i++) {
            sNum = numeric.substring(i, i + 1);
            if ("+".equals(sNum)) {
                //g.drawRegion(this.numericPic, 0, iNumStartY, 10, 17, Constant.TRANS_NONE, startX, startY + 7, 0);
                //startX = startX + 12;
                g.drawRegion(numericPic, 0, iNumStartY, 11, 16, Constant.TRANS_NONE, startX, startY + 7, 0);
                startX = startX + 12;
            } else if ("-".equals(sNum)) {
                //g.drawRegion(this.numericPic, 10, iNumStartY, 10, 17, Constant.TRANS_NONE, startX, startY + 7, 0);
                //startX = startX + 12;
                g.drawRegion(numericPic, 11, iNumStartY, 11, 16, Constant.TRANS_NONE, startX, startY + 7, 0);
                startX = startX + 12;
            } else {
                //g.drawRegion(this.numericPic, 20 + Integer.parseInt(sNum) * 11, iNumStartY, 11, 17, Constant.TRANS_NONE, startX, startY + 7, 0);
                //startX = startX + 10;
                g.drawRegion(numericPic, 22 + Integer.parseInt(sNum) * 11, iNumStartY, 11, 16, Constant.TRANS_NONE, startX, startY + 7, 0);
                startX = startX + 11;
            }
        }
        //#endif
        return startX;
    }

    /**
     * 绘制伤害字符
     * @param g
     * @param byPlace  文字在图片上的位置
     * @param startX
     * @param startY
     */
    private int drawDamageWord(Graphics g, byte byDamageType, String numeric, int startX, int startY) {
        switch (byDamageType) {
            //#if NOKIA_S40V3 || NORMAL_240_400 || MOTO || K790
//#             case PLAYER_INTO_BATTLE:
//#                 Tools.drawShadowString(g, (byte) 1, strWordPic[0], startX, startY, 0xff0000, 0xffffff);
//#                 break;
//#             case PLAYER_OUT_BATTLE:
//#                 Tools.drawShadowString(g, (byte) 1, strWordPic[1], startX, startY, 0x00ccff, 0xffffff);
//#                 break;
//#             case DAMAGE_TYPE_CRIT:
//#                 Tools.drawShadowString(g, (byte) 1, strWordPic[3], startX, startY, 0xffff00, 0xffffff);
//#                 break;
//#             case DAMAGE_TYPE_DODGE:
//#                 Tools.drawShadowString(g, (byte) 1, strWordPic[4], startX, startY, 0xb4b4b4, 0xffffff);
//# //                g.drawRegion(this.wordPic, 67, 15, 31, 14, Constant.TRANS_NONE, startX, startY, 0);
//#                 break;
//#             case PLAYER_UPGRADE:
//#                 Tools.drawShadowString(g, (byte) 1, strWordPic[5], startX, startY, 0xb4b4b4, 0xffffff);
//#                 break;
//#             case DAMAGE_TYPE_RESISY:
//#                 Tools.drawShadowString(g, (byte) 1, strWordPic[2], startX, startY, 0xb4b4b4, 0xffffff);
//#                 break;
            //#else
            case PLAYER_INTO_BATTLE:
                g.drawRegion(this.wordPic, 0, 0, 58, 14, Constant.TRANS_NONE, startX, startY, 0);
                startX = startX + 58;
                break;
            case PLAYER_OUT_BATTLE:
                g.drawRegion(this.wordPic, 60, 0, 58, 14, Constant.TRANS_NONE, startX, startY, 0);
                startX = startX + 58;
                break;
            case DAMAGE_TYPE_CRIT:
                g.drawRegion(this.wordPic, 0, 15, 66, 14, Constant.TRANS_NONE, startX, startY, 0);
                startX = startX + 70;
                for (byte i = 0; i < numeric.length(); i++) {
                    //g.drawRegion(this.critNumPic, Integer.parseInt(numeric.substring(i, i + 1)) * 13, 0, 13, 21, Constant.TRANS_NONE, startX, startY - 3, 0);
                    g.drawRegion(this.critNumPic, Integer.parseInt(numeric.substring(i, i + 1)) * 15, 0, 15, 19, Constant.TRANS_NONE, startX, startY - 3, 0);
                    startX = startX + 15;
                }
                break;
            case DAMAGE_TYPE_DODGE:
                g.drawRegion(this.wordPic, 67, 15, 31, 14, Constant.TRANS_NONE, startX, startY, 0);
                startX = startX + 29;
                break;
            case PLAYER_UPGRADE:
                g.drawRegion(this.wordPic, 98, 15, 79, 14, Constant.TRANS_NONE, startX, startY, 0);
                startX = startX + 79;
                break;
            case DAMAGE_TYPE_RESISY:
                g.drawRegion(this.wordPic, 118, 0, 25, 14, Constant.TRANS_NONE, startX, startY, 0);
                startX = startX + 29;
                break;
            //#endif
        }
        return startX;
    }

    //获得当前的个数
    public byte getSize() {
        return this.size;
    }
}
